#ifndef CPU_drv_I2CH
 #define CPU_drv_I2CH

 #include <stdint.h> 
// #include "SetSystem.h"
 #include "FreeRTOS.h"
 #include "task.h"
 #include "semphr.h"
 #include "PrimitivesI2C.h"
// #include "SetI2C.h"






void I2C0_Init(void);
void I2C0_Init_After_PowerUp(void);  
//
STATUS_I2C ReadFromModul(uint8_t devID, uint16_t adr, uint8_t Nbytes);
STATUS_I2C WriteToModul(uint8_t devID, uint16_t adr, uint8_t Nbytes, uint8_t const *pSource);
//
uint8_t BufToCHAR(uint8_t CellNum);
uint16_t BufToUSHT(uint8_t CellNum);
uint32_t BufToUINT(uint8_t CellNum);
//
bool SDA_SCL_Stretch_Check(void);
//

 #define BitFreqI2C0    100000  //I2C0 bit frequency (Hz)
// #define I2C0sAdr        1       //I2C0 slave address

  

 #define BufI2C0size           64
 #define TimeOutI2Cfnsh      ( ( portTickType ) 100 / portTICK_RATE_MS )   //100mSec
 #define TimeOutI2Cgrab      ( ( portTickType ) 1000 / portTICK_RATE_MS )  //1000mSec
  
  
  
  
  
 #define SCL_PERIOD          ( (Fcclk>>2)/BitFreqI2C0 )
 #define I2C0SCLHdef         ( SCL_PERIOD >> 1 )
 #define I2C0SCLLdef         ( SCL_PERIOD - I2C0SCLHdef )
  
 
 




#endif
